<!--接口管理页面-->
<template>
  <a-card :bordered='false'>
    <search ref='search' :config='searchConfig' @search='search' @getHeight='getHeight' />
    <div class='page_table'>
      <vxe-grid
        ref='xGrid'
        :border='true'
        :resizable='true'
        :showOverflow='true'
        size='mini'
        :loading='loading'
        :height='pageHeight-seachHeight-90'
        :align='left'
        :columns='columns'
        :data='dataSource'
        :toolbar-config='tableToolbar'
       :checkbox-config="checkboxConfig"
        v-bind='vexConfig'
        @checkbox-change='selectChangeEvent'
        @checkbox-all='selectChangeEvent'
      >
        <template #toolbar_buttons>
          <div class='table-operator'>
            <a-button @click='handleAdd' type='primary'>新增</a-button>
            <a-dropdown v-if='selectedRowKeys.length > 0'>
              <a-menu slot='overlay'>
                <a-menu-item key='1' @click='batchDel'>
                  <a-icon type='delete' />
                  删除
                </a-menu-item>
              </a-menu>
              <a-button style='margin-left: 8px'>
                批量操作
                <a-icon type='down' />
              </a-button>
            </a-dropdown>
          </div>
        </template>
        <template #status='{ row }'>
          {{ row.status == 1 ? '启用':'停用' }}
        </template>
        <template #priority="{ row,rowIndex }">
          {{ filterDictText(manner, row.priority) }}
        </template>
        <template #action='{ row:record }'>
          <a @click='handleEdit(record)'>编辑</a>
          <a-divider type='vertical' />
          <a-popconfirm title='确定删除吗?' @confirm='() => handleDelete(record.id)'>
            <a>删除</a>
          </a-popconfirm>
        </template>
        <template #pager>
          <vxe-pager
            :layouts="['Total', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump','Sizes', 'FullJump']"
            :currentPage.sync='ipagination.current'
            :page-size.sync='ipagination.pageSize'
            :total='ipagination.total'
            :pageSizes='ipagination.pageSizeOptions'
            @page-change='handlePageChange'>
          </vxe-pager>
        </template>
      </vxe-grid>
    </div>
    <!-- 表单区域 -->
    <down-config-modal ref='modalForm' @ok='modalFormOk'></down-config-modal>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import downConfigModal from './modules/DownconfigModal'
import { PageListMixin } from '@/mixins/PageListMixin'
import { getAction } from '@/api/manage'
import ARow from 'ant-design-vue/es/grid/Row'
import ARangePicker from 'ant-design-vue/es/date-picker/RangePicker'
import { filterDictText } from '@comp/dict/CnDictSelectUtil'

export default {
  name: 'down_config_list',
  mixins: [PageListMixin],
  components: {
    ARangePicker,
    ARow,
    downConfigModal
  },
  data() {
    return {
      description: '内部接口',
      searchConfig: [
        {
          type: 'input',
          name: 'impName',
          placeholder: '接口名称'
        }
      ],
      columns: [
        { type: 'checkbox', width: 50, fixed: 'left' },
        {
          title: '所属模块',
          minWidth: 60,
          field: 'module'
        },
        {
          title: '接口名称',
          minWidth: 80,
          field: 'impName',
        },
        {
          title: '接口标记',
          minWidth: 80,
          field: 'impKey',
        },
        {
          title: '接口bean',
          minWidth: 80,
          field: 'impBean',
        },
        {
          title: '优先级别',
          minWidth: 80,
          field: 'priority',
          slots: { default: 'priority' }
        },
        {
          title: '创建人',
          minWidth: 80,
          field: 'createName'
        },
        {
          title: '创建时间',
          minWidth: 80,
          field: 'createTime'
        },
        {
          title: '更新人',
          minWidth: 80,
          field: 'updateName'
        },
        {
          title: '更新时间',
          minWidth: 80,
          field: 'updateTime'
        },
        {
          title: '停用启用状态',
          align: 'center',
          minWidth: 80,
          field: 'status',
          slots:{default:"status"}
        },
        {
          title: '备注',
          align: 'center',
          minWidth: 80,
          field: 'remarks'
        },
        {
          title: '操作',
          field: 'action',
          width: 100,
          align: 'center',
          slots:{default:"action"}
        }
      ],
      url: {
        list: window._CONFIG['domianJobURL'] + '/downConfig/findPageList',
        delete: window._CONFIG['domianJobURL'] + '/downConfig/delete',
        deleteBatch: window._CONFIG['domianJobURL'] + '/downConfig/deleteBatch'
      }
    }
  },
  methods: {
    filterDictText,
  }
}
</script>

<style scoped>
@import '~@assets/less/common.less';
</style>
